package com.ms.service.impl;

import com.ms.mapper.UserLeaveMapper;
import com.ms.pojo.Leave_apply;
import com.ms.service.UserLeaveService;
import com.ms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.nio.file.FileStore;
import java.util.Date;

@Service
public class UserLeaveServiceImpl implements UserLeaveService {
    @Autowired
    private UserLeaveMapper userLeaveMapper;


    @Override
    public int insertLeaveApply(Leave_apply leave_apply) {
        try {

            // 设置申请时间等默认值
            if (leave_apply.getApplyTime() == null) {
                leave_apply.setApplyTime(new Date());
            }

            return userLeaveMapper.insertLeaveApply(leave_apply);


        }
        catch (Exception e) {
            e.printStackTrace();

        }
        return userLeaveMapper.insertLeaveApply(leave_apply);
    }
}
